package com.niiwoo.civet.trade.configuration;

import com.niiwoo.civet.trade.constant.RabbitConstant;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by dell on 2017/12/15.
 */
@Configuration
public class InvestEventForActivityMqConfiguration {
	//**********************
	//投资事件活动mq配置
	//**********************
	@Bean
	public Exchange investEventForActivityExchange() {
		return new DirectExchange(RabbitConstant.Exchange.INVEST_EVENT_FOR_ACTIVITY, true, true);
	}

	@Bean
	public Queue investEventForActivityQueue() {
		return new Queue(RabbitConstant.Queue.INVEST_EVENT_FOR_ACTIVITY, true);
	}

	@Bean
	public Binding investEventForActivityBinding() {
		return BindingBuilder.bind(investEventForActivityQueue()).to(investEventForActivityExchange()).with(RabbitConstant.RoutingKey.INVEST_EVENT_FOR_ACTIVITY).noargs();
	}
}
